//
//  Test.swift
//  LeetCodeDemo
//
//  Created by OS on 2022/11/29.
//

import Foundation

class TestClass {
    
    func selectSort(_ arr: inout [Int]) {
        for i in 0..<arr.count - 1 {
            var min = i
            for j in i + 1..<arr.count {
                if arr[j] < arr[min] {
                    min = j
                }
            }
            arr.swapAt(i, min)
        }
    }
    
    
    func test() {
        
        var arr = [1, 8, 9, 5, 4, 3]
        
        selectSort(&arr)
        
        print(arr)
    }
    
}



